home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / scripts / alien-glow-arrow.scm.z / alien-glow-arrow.scm
Encoding:
Text File  |  1999-07-21  |  4.1 KB  |  149 lines

  1.  
  2.  
  3. ; The GIMP -- an image manipulation program
  4. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  5. ; Alien Glow themed arrows for web pages
  6. ; Copyright (c) 1997 Adrian Likins
  7. ; aklikins@eos.ncsu.edu
  8. ;
  9. ;
  10. ; Based on code from
  11. ; Federico Mena Quintero
  12. ; federico@nuclecu.unam.mx
  13. ; This program is free software; you can redistribute it and/or modify
  14. ; it under the terms of the GNU General Public License as published by
  15. ; the Free Software Foundation; either version 2 of the License, or
  16. ; (at your option) any later version.
  17. ; This program is distributed in the hope that it will be useful,
  18. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. ; GNU General Public License for more details.
  21. ; You should have received a copy of the GNU General Public License
  22. ; along with this program; if not, write to the Free Software
  23. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  
  25.  
  26.  
  27.  
  28.  
  29. (define (make-point x y)
  30.   (cons x y))
  31.  
  32. (define (point-x p)
  33.   (car p))
  34.  
  35. (define (point-y p)
  36.   (cdr p))
  37.  
  38. (define (point-list->double-array point-list)
  39.   (define (convert points array pos)
  40.     (if (not (null? points))
  41.     (begin
  42.       (aset array (* 2 pos) (point-x (car points)))
  43.       (aset array (+ 1 (* 2 pos)) (point-y (car points)))
  44.       (convert (cdr points) array (+ pos 1)))))
  45.  
  46.   (let* ((how-many (length point-list))
  47.      (a (cons-array (* 2 how-many) 'double)))
  48.     (convert point-list a 0)
  49.     a))
  50.  
  51. (define (make-arrow size offset)
  52.   (list (make-point offset offset)
  53.     (make-point (- size offset) (/ size 2))
  54.     (make-point offset (- size offset))))
  55.  
  56.  
  57. (define (rotate-points points size orientation)
  58.   (if (null? points)
  59.       '()
  60.       (let* ((p (car points))
  61.          (px (point-x p))
  62.          (py (point-y p)))
  63.     (cons (cond ((eq? orientation 'right) (make-point px py))
  64.             ((eq? orientation 'left) (make-point (- size px) py))
  65.             ((eq? orientation 'up) (make-point py (- size px)))
  66.             ((eq? orientation 'down) (make-point py px)))
  67.           (rotate-points (cdr points) size orientation)))))
  68.  
  69.  
  70. (define (script-fu-alien-glow-right-arrow size orientation glow-color bg-color flatten)
  71.   (let* ((img (car (gimp-image-new size size RGB)))
  72.      (grow-amount (/ size 12))
  73.      (blur-radius (/ size 3))
  74.      (offset (/ size 6))
  75.      (ruler-layer (car (gimp-layer-new img size size  RGBA_IMAGE "Ruler" 100 NORMAL)))
  76.      (glow-layer (car (gimp-layer-new img size size  RGBA_IMAGE "Alien Glow" 100 NORMAL)))
  77.      (bg-layer (car (gimp-layer-new img size size  RGB_IMAGE "Back" 100 NORMAL)))
  78.      (big-arrow (point-list->double-array (rotate-points (make-arrow size offset) size orientation)))
  79.      (old-fg (car (gimp-palette-get-foreground)))
  80.      (old-bg (car (gimp-palette-get-background))))
  81.     
  82.     
  83.     (gimp-image-disable-undo img)
  84.     ;(gimp-image-resize img (+ length height) (+ height height) 0 0)
  85.     (gimp-image-add-layer img bg-layer 1)
  86.     (gimp-image-add-layer img glow-layer -1)
  87.     (gimp-image-add-layer img ruler-layer -1)
  88.     
  89.     (gimp-edit-clear img glow-layer)
  90.     (gimp-edit-clear img ruler-layer)
  91.  
  92.  
  93.     (gimp-free-select img 6 big-arrow REPLACE TRUE FALSE 0)
  94.  
  95.     (gimp-palette-set-foreground '(103 103 103))
  96.     (gimp-palette-set-background '(0 0 0))
  97.     (gimp-blend img ruler-layer FG-BG-RGB NORMAL SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE 0 0 0 0 size size)
  98.     
  99.     (gimp-selection-grow img grow-amount)
  100.     (gimp-palette-set-background glow-color)
  101.     (gimp-edit-fill img glow-layer)
  102.  
  103.     (gimp-selection-none img)
  104.  
  105.  
  106.     (plug-in-gauss-rle 1 img glow-layer blur-radius TRUE TRUE)
  107.  
  108.     (gimp-palette-set-background bg-color)
  109.     (gimp-edit-fill img bg-layer)
  110.     
  111.     (gimp-palette-set-background old-bg)
  112.     (gimp-palette-set-foreground old-fg)
  113.  
  114.     (if (= flatten TRUE)
  115.     (gimp-image-flatten img))
  116.     (gimp-image-enable-undo img)
  117.     (gimp-display-new img)))
  118.  
  119. (script-fu-register "script-fu-alien-glow-right-arrow"
  120.             "<Toolbox>/Xtns/Script-Fu/Web page themes/Alien Glow/Arrow"
  121.             "Create aan X-file deal"
  122.             "Adrian Likins"
  123.             "Adrian Likins"
  124.             "1997"
  125.             ""
  126.             SF-VALUE "Size" "32"
  127.             SF-VALUE "Orientation" "'right"
  128.             SF-COLOR "Glow Color" '(63 252 0)
  129.             SF-COLOR "Background Color" '(0 0 0)
  130.             SF-TOGGLE "Flatten Image" TRUE)
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.